package com.briup.app04.service.impl;

import com.briup.app04.bean.Article;
import com.briup.app04.bean.Test;
import com.briup.app04.dao.ArticleMapper;
import com.briup.app04.dao.TestMapper;
import com.briup.app04.service.IArticleService;
import org.apache.ibatis.annotations.Results;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class ArticleServiceImpl implements IArticleService {
    @Resource
    private ArticleMapper articleMapper;


    @Override
    public List<Article> findAll() {
        return articleMapper.selectAll();
    }



    @Override
    public void saveOrUpdate(Article article) {
        if(article.getId()!=null){
            articleMapper.update(article);
        }else{
        articleMapper.insert(article);}
    }

    @Override
    public void deleteById(Long id) {
        articleMapper.deleteById(id);
    }

}




